Grouping

Using parentheses, expressions may be grouped together. For example,

(top|middle|bottom)

matches any of the strings top, middle or bottom. Grouping is especially useful when constructing compound regular expressions which use one or more of  the expressions described above. For example,

([A-Za-z_][A-Za-z0-9_]*)|(-?+?[0-9])

matches any C style identifier or any integer constant.

See Also